import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    circleselectionstatus: 0,
    screenWidth: window.innerWidth, // 默认值
  },
  mutations: {
    setCircleselectionstatus(state, status) {
      state.circleselectionstatus = status;
    },
     SET_SCREEN_WIDTH(state, width) {
        state.screenWidth = width;
      },
  },
  actions: {
    updateCircleselectionstatus({ commit }, status) {
      commit('setCircleselectionstatus', status);
    },
    updateScreenWidth({ commit }) {
      commit('SET_SCREEN_WIDTH', window.innerWidth);
    },
  },
  getters: {
    getScreenWidth: (state) => state.screenWidth,
  },
});